import React from 'react';
import './index.css';

/**
 * 抽奖组件
 */

export default class LuckDraw extends React.Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {

        var iframe = document.getElementById('iframe');
        iframe.onload = function (e) {
            console.log('加载完成:', e)
        }

        // 这里等确定后再想办法实现监听方法

        // 监听goModifyAddress事件,跳转到填写地址信息
        iframe.src = this.props.luckDrawInfo.prize_modify_address;

        // 监听finishActivity事件，跳转到抽奖首页
        iframe.src = this.props.luckDrawInfo.access_url

    }

    render() {
        return (
            <iframe
                id="iframe"
                style={{ overflow: 'visible' }}
                ref="iframe"
                src={this.props.luckDrawInfo.access_url}
                width="100%"
                height='99%'
                scrolling="no"
                frameBorder="0"
            />
        )
    }
}
